<?php
/**
 * Created by PhpStorm.
 * User: tri
 * Date: 6/16/14
 * Time: 5:13 PM
 */
require_once('../../class_ajax_request/classAjax.php');
include_once('../../application/functions.php');
include_once('../../application/DataConfig.php');
include_once('answer.content.function.php');
$html_button = '';

$post_type_slider_flag = 0;
$array_meta_silder = array();
$count_slider_vote = 0;
$array_meta = array();
foreach($post_meta_array as $pos_meta)
{

    //get value
    $post_type = $pos_meta['post_type'];
    $post_question = json_decode($pos_meta['meta_value']);
    $post_id = $pos_meta['post_id'];
    $meta_id = $pos_meta['id'];
    $user_create = $pos_meta['user'];
    $extra_value = $pos_meta['extra_value'];
    //binary and multi
    $check = $obj->checkAnswered($meta_id,$_SESSION['authenticated'] );
    $check = $check[0]['count_check'];
    if($post_type == 1 || $post_type == 2){
        //button
        //&& $_SESSION['authenticated'] != $user_create
//        if($check == 0  ){
//            $html_button = get_default_button($meta_id, $post_id, $post_type, $post_question, $user_create, $disable);
//            echo $html_button;
//        }
//        else{
            //html answer
            $obj = new AjaxRequest();
            $array_info = get_default_answer($obj, $post_id);

            $chart = '';
            if($post_type == 1 || $post_type == 2)
                $chart = binarychart($array_info,$post_id);
//            if($post_type == 2)
//                $chart = multichart($array_info, $post_question);
            echo $chart;
//        }

    }
    //slider
    if($post_type == 3){
        //button
//        if($check == 0 ){
//            $slider_html = get_slider_html($meta_id, $post_id, $post_type, $post_question, $user_create,  $disable);
//                echo $slider_html;
//        }else{
            //html
            $html_answer = get_slider_answer($obj,$post_id, 'Average',$extra_value);
            echo $html_answer;
//        }


    }
    //star
    if($post_type == 4){
//        if($check == 0 ){
//            $html_button = get_default_button($meta_id, $post_id, $post_type, $post_question, $user_create,  $disable,$obj);
//            echo $html_button;
//        }else{
            $html_answer = get_slider_answer($obj,$post_id, 'RATING');
            echo $html_answer;
//       }
    }

}
?>

<style>
    <?php if($check != 0){
        ?>

    #post-li-<?php  echo $key['id'] ?> .actions_content{
        display: block;
    }

    <?php
    }else{ ?>
    #post-li-<?php  echo $key['id'] ?> .actions_content{
        display: none!important;
    }
    <?php
    }?>
</style>
